package com.ssm.hj.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ssm.hj.page.Page;
import com.ssm.hj.search.PsychologySearch;
import com.ssm.hj.service.PsychologyService;
import com.ssm.mapper.PsychologyMapper;
import com.ssm.pojo.Psychology;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PsychologyServiceImpl implements PsychologyService {
    @Resource
    private PsychologyMapper psychologyMapper;
    @Override
    public PageInfo<Psychology> queryPsychologyAllService(Page<PsychologySearch> page) throws Exception {
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        return new PageInfo<Psychology>(this.psychologyMapper.queryPsychologyAll(page.getSearchObj()));
    }

    @Override
    public int savePsychologyService(Psychology psychology) throws Exception {
        return this.psychologyMapper.savePsychology(psychology);
    }
}
